package com.depth.viewer.request.page
{
	import com.depth.viewer.manager.ViewerSystemManager;
	
	import flash.display.DisplayObject;
	import flash.events.MouseEvent;
	
	import mx.core.FlexGlobals;
	import mx.managers.PopUpManager;
	
	import spark.components.BorderContainer;
	import spark.components.Image;
	import spark.components.Label;

	/**
	 *@Author JueYue
	 *@date Oct 24, 2013 2:50:07 PM
	 * 404 错误界面
	 **/
	public class FZFPage
	{
		public function FZFPage()
		{
		}
		
		private var contain:BorderContainer;
		
		public function showErrorInfo():void{
			contain = getPopUpAnchor();
			PopUpManager.addPopUp(contain,FlexGlobals.topLevelApplication as DisplayObject,true);
			PopUpManager.centerPopUp(contain);
		}
		
		[Embed(source="assets/image/404.jpg")]
		private var bgImage:Class;
		
		[Embed(source="assets/image/loginBtn.jpg")]
		private var btImage:Class;
		
		private function getPopUpAnchor():BorderContainer{
			if(contain){
				return contain;
			}
			contain = new BorderContainer();
			var image:Image = new Image();
			image.source = bgImage;
			image.width = 500;
			image.height = 308;
			contain.addElement(image);
			var label:Label = new Label();
			label.text = "与服务器网络连接异常,请重新登陆";
			label.top = 10;
			label.left = 20;
			label.setStyle("fontWeight","bold");
			label.setStyle("fontSize",18);
			contain.addElement(label);
			image = new Image();
			image.source = btImage;
			image.top = 240;
			image.left = 40;
			image.width = 97;
			image.height = 28;
			image.addEventListener(MouseEvent.CLICK,resetSystem);
			contain.addElement(image);
			return contain;
		}
		
		private function resetSystem(e:MouseEvent):void{
			ViewerSystemManager.getInstance().restart();
			PopUpManager.removePopUp(contain);
		}
		
	}
}